package com.fitso.model.util.common;

import java.io.File;
import java.io.IOException;

public class FileUtils extends org.apache.commons.io.FileUtils {
	/**
	 * Copies the target file with '.bak' appended and the deletes the target
	 * file
	 * 
	 * @param target
	 * @throws IOException
	 * @return new file name 
	 */
	public static File quickBackup(File target) throws IOException {
		String newFileName = target.getAbsolutePath() + ".bak";
		File newFile = new File(newFileName);
		
		copyFile(target, newFile);
		target.delete();
		
		return newFile;
	}
}
